<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>博主信息修改页面</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/controls/jquery-easyui-1.3.3/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/controls/jquery-easyui-1.3.3/themes/icon.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/controls/jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/controls/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/controls/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/controls/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/controls/ueditor/ueditor.all.min.js"></script>
<!-- 建议手动加载语言，避免在IE下有时因为加载语言失败导致编辑器加载失败 -->
<!-- 这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目配置的英文，这里加载的中文，那最后就是中文 -->

<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/controls/ueditor/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript">
	function submitData() {
		var nickname = $("#nickname").val();
		var sign = $("#sign").val();
		var profile = UE.getEditor('profile').getContent();
		
		if(nickname == null || nickname == "") {
			$.messager.alert("系统提示", "请输入昵称!");
		} else if(sign == null || sign == "") {
			$.messager.alert("系统提示", "请输入个性签名!");
		} else if(profile == null || profile == "") {
			$.messager.alert("系统提示", "请输入简介!");
		} else {
			$("#pf").val(profile);
			$("#form1").submit();
		}
	}
</script>
</head>
<body style="margin: 10px">
	<div id="p" class="easyui-panel" title="修改个人信息" style="padding: 10px">
		<form id="form1" method="post" action="${pageContext.request.contextPath}/admin/blogger/save.do" enctype="multipart/form-data">
			<table cellspacing="20px">
				<tr>
					<td style="width: 80px">用户名:</td>
					<td>
						<input type="hidden" id="bloggerId" name="bloggerId" value="${blogger.bloggerId}" />
						<input type="text" id="username" name="username" readonly="readonly" style="width:200px" value="${blogger.username}" />
					</td>
				</tr>
				<tr>
					<td>昵称:</td>
					<td>
						<input type="text" id="nickname" name="nickname" style="width:200px"/>
					</td>
				</tr>
				<tr>
					<td>个性签名:</td>
					<td>
						<input type="text" id="sign" name="sign" value="${blogger.sign}" style="width: 400px"/>
					</td>
				</tr>
				<tr>
					<td>个人头像:</td>
					<td>
						<input type="file" id="headPortraitFile" name="headPortraitFile" style="width: 400px" />
					</td>
				</tr>
				<tr>
					<td>个人简介：</td>
					<td>
						<script type="text/plain" id="profile" style="width: 900px; height: 400px"></script>
						<input type="hidden" id="pf" name="profile" />
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<a href="javascript:submitData();" class="easyui-linkbutton" data-options="iconCls:'icon-submit'">提交</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
	
	<script type="text/javascript">
		var ue = UE.getEditor('profile');
		ue.addListener("ready", function() {
			// 通过UE自己封装的ajax请求数据
			UE.ajax.request("${pageContext.request.contextPath}/admin/blogger/findBlogger.do", {
				method : "post",
				async : false,
				data : {},
				onsuccess : function(result) {
					result = eval("(" + result.responseText + ")");
					$("#nickname").val(result.nickname);
					$("#sign").val(result.sign);
					UE.getEditor('profile').setContent(result.profile);
				}
			});
		});
	</script>
</body>
</html>